package cn.iocoder.yudao.module.reading.enums.common;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 难度级别枚举
 *
 * @author 芋道源码
 */
@AllArgsConstructor
@Getter
public enum DifficultyLevelEnum {

    BEGINNER("beginner", "初级"),
    INTERMEDIATE("intermediate", "中级"),
    ADVANCED("advanced", "高级");

    /**
     * 难度代码
     */
    private final String code;
    /**
     * 难度名称
     */
    private final String name;

    public static DifficultyLevelEnum fromCode(String code) {
        for (DifficultyLevelEnum level : values()) {
            if (level.getCode().equals(code)) {
                return level;
            }
        }
        return null;
    }

}
